<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
  <meta name="description" content="API docs for the TOTP class from the dart_otp library, for the Dart programming language.">
  <title>TOTP class - dart_otp library - Dart API</title>
  <!-- required because all the links are pseudo-absolute -->
  <base href="..">

  <link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500,400i,400,300|Source+Sans+Pro:400,300,700" rel="stylesheet">
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <link rel="stylesheet" href="static-assets/github.css">
  <link rel="stylesheet" href="static-assets/styles.css">
  <link rel="icon" href="static-assets/favicon.png">
  
</head>

<body>

<div id="overlay-under-drawer"></div>

<header id="title">
  <button id="sidenav-left-toggle" type="button">&nbsp;</button>
  <ol class="breadcrumbs gt-separated dark hidden-xs">
    <li><a href="index.html">dart_otp</a></li>
    <li><a href="dart_otp/dart_otp-library.html">dart_otp</a></li>
    <li class="self-crumb">TOTP class</li>
  </ol>
  <div class="self-name">TOTP</div>
  <form class="search navbar-right" role="search">
    <input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>
</header>

<main>

  <div id="dartdoc-sidebar-left" class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
    <header id="header-search-sidebar" class="hidden-l">
      <form class="search-sidebar" role="search">
        <input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
      </form>
    </header>
    
    <ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
      <li><a href="index.html">dart_otp</a></li>
      <li><a href="dart_otp/dart_otp-library.html">dart_otp</a></li>
      <li class="self-crumb">TOTP class</li>
    </ol>
    
    <h5>dart_otp library</h5>
    <ol>
      <li class="section-title"><a href="dart_otp/dart_otp-library.html#classes">Classes</a></li>
      <li><a href="dart_otp/HOTP-class.html">HOTP</a></li>
      <li><a href="dart_otp/TOTP-class.html">TOTP</a></li>
    
    
    
    
    
      <li class="section-title"><a href="dart_otp/dart_otp-library.html#enums">Enums</a></li>
      <li><a href="dart_otp/OTPAlgorithm-class.html">OTPAlgorithm</a></li>
      <li><a href="dart_otp/OTPType-class.html">OTPType</a></li>
    
    
    </ol>
  </div>

  <div id="dartdoc-main-content" class="col-xs-12 col-sm-9 col-md-8 main-content">
      <div><h1><span class="kind-class">TOTP</span> class </h1></div>

    <section class="desc markdown">
      <p>TOTP class will generate the OTP (One Time Password) object with the current or given time.</p>
    </section>
    

    <section class="summary offset-anchor" id="constructors">
      <h2>Constructors</h2>

      <dl class="constructor-summary-list">
        <dt id="TOTP" class="callable">
          <span class="name"><a href="dart_otp/TOTP/TOTP.html">TOTP</a></span><span class="signature">({<span class="parameter" id="-param-secret"><span class="type-annotation">String</span> <span class="parameter-name">secret</span>, </span> <span class="parameter" id="-param-digits"><span class="type-annotation">int</span> <span class="parameter-name">digits</span>: <span class="default-value">6</span>, </span> <span class="parameter" id="-param-interval"><span class="type-annotation">int</span> <span class="parameter-name">interval</span>: <span class="default-value">30</span>, </span> <span class="parameter" id="-param-algorithm"><span class="type-annotation"><a href="dart_otp/OTPAlgorithm-class.html">OTPAlgorithm</a></span> <span class="parameter-name">algorithm</span>: <span class="default-value">OTPAlgorithm.SHA1</span></span> })</span>
        </dt>
        <dd>
          This constructor will create an TOTP instance. <a href="dart_otp/TOTP/TOTP.html">[...]</a>
        </dd>
      </dl>
    </section>

    <section class="summary offset-anchor" id="instance-properties">
      <h2>Properties</h2>

      <dl class="properties">
        <dt id="extraUrlProperties" class="property">
          <span class="name"><a href="dart_otp/TOTP/extraUrlProperties.html">extraUrlProperties</a></span>
          <span class="signature">&#8594; Map<span class="signature">&lt;<wbr><span class="type-parameter">String</span>, <span class="type-parameter">dynamic</span>&gt;</span></span>         
        </dt>
        <dd>
          To access custom properties when generating the url.
                  <div class="features">read-only</div>
</dd>
        <dt id="interval" class="property">
          <span class="name"><a href="dart_otp/TOTP/interval.html">interval</a></span>
          <span class="signature">&#8596; int</span>         
        </dt>
        <dd>
          Period in which should be generated new tokens.
                  <div class="features">read / write</div>
</dd>
        <dt id="type" class="property">
          <span class="name"><a href="dart_otp/TOTP/type.html">type</a></span>
          <span class="signature">&#8594; <a href="dart_otp/OTPType-class.html">OTPType</a></span>         
        </dt>
        <dd>
          The type of the token.
                  <div class="features">read-only</div>
</dd>
        <dt id="algorithm" class="property inherited">
          <span class="name"><a href="dart_otp/TOTP/algorithm.html">algorithm</a></span>
          <span class="signature">&#8596; <a href="dart_otp/OTPAlgorithm-class.html">OTPAlgorithm</a></span>         
        </dt>
        <dd class="inherited">
          The crypto algorithm used on HMAC encoding.
                  <div class="features">read / write, inherited</div>
</dd>
        <dt id="digits" class="property inherited">
          <span class="name"><a href="dart_otp/TOTP/digits.html">digits</a></span>
          <span class="signature">&#8596; int</span>         
        </dt>
        <dd class="inherited">
          The length of the one-time password, between 6 and 8.
                  <div class="features">read / write, inherited</div>
</dd>
        <dt id="hashCode" class="property inherited">
          <span class="name"><a href="dart_otp/TOTP/hashCode.html">hashCode</a></span>
          <span class="signature">&#8594; int</span>         
        </dt>
        <dd class="inherited">
          The hash code for this object. <a href="dart_otp/TOTP/hashCode.html">[...]</a>
                  <div class="features">read-only, inherited</div>
</dd>
        <dt id="runtimeType" class="property inherited">
          <span class="name"><a href="dart_otp/TOTP/runtimeType.html">runtimeType</a></span>
          <span class="signature">&#8594; Type</span>         
        </dt>
        <dd class="inherited">
          A representation of the runtime type of the object.
                  <div class="features">read-only, inherited</div>
</dd>
        <dt id="secret" class="property inherited">
          <span class="name"><a href="dart_otp/TOTP/secret.html">secret</a></span>
          <span class="signature">&#8596; String</span>         
        </dt>
        <dd class="inherited">
          The Base32 secret key used to generate the one-time password.
                  <div class="features">read / write, inherited</div>
</dd>
      </dl>
    </section>

    <section class="summary offset-anchor" id="instance-methods">
      <h2>Methods</h2>
      <dl class="callables">
        <dt id="now" class="callable">
          <span class="name"><a href="dart_otp/TOTP/now.html">now</a></span><span class="signature">(<wbr>)
            <span class="returntype parameter">&#8594; String</span>
          </span>
                  </dt>
        <dd>
          Generate the TOTP value with current time. <a href="dart_otp/TOTP/now.html">[...]</a>
                  
</dd>
        <dt id="value" class="callable">
          <span class="name"><a href="dart_otp/TOTP/value.html">value</a></span><span class="signature">(<wbr>{<span class="parameter" id="value-param-date"><span class="type-annotation">DateTime</span> <span class="parameter-name">date</span></span> })
            <span class="returntype parameter">&#8594; String</span>
          </span>
                  </dt>
        <dd>
          Generate the OTP with a custom time. <a href="dart_otp/TOTP/value.html">[...]</a>
                  
</dd>
        <dt id="verify" class="callable">
          <span class="name"><a href="dart_otp/TOTP/verify.html">verify</a></span><span class="signature">(<wbr>{<span class="parameter" id="verify-param-otp"><span class="type-annotation">String</span> <span class="parameter-name">otp</span>, </span> <span class="parameter" id="verify-param-time"><span class="type-annotation">DateTime</span> <span class="parameter-name">time</span></span> })
            <span class="returntype parameter">&#8594; bool</span>
          </span>
                  </dt>
        <dd>
          Verifies the TOTP value passed in against the current time. <a href="dart_otp/TOTP/verify.html">[...]</a>
                  
</dd>
        <dt id="generateOTP" class="callable inherited">
          <span class="name"><a href="dart_otp/TOTP/generateOTP.html">generateOTP</a></span><span class="signature">(<wbr>{<span class="parameter" id="generateOTP-param-input"><span class="type-annotation">int</span> <span class="parameter-name">input</span>, </span> <span class="parameter" id="generateOTP-param-algorithm"><span class="type-annotation"><a href="dart_otp/OTPAlgorithm-class.html">OTPAlgorithm</a></span> <span class="parameter-name">algorithm</span>: <span class="default-value">OTPAlgorithm.SHA1</span></span> })
            <span class="returntype parameter">&#8594; String</span>
          </span>
                  </dt>
        <dd class="inherited">
          When class HOTP or TOTP pass the input params to this
function, it will generate the OTP object with params,
the params may be counter or time. <a href="dart_otp/TOTP/generateOTP.html">[...]</a>
                  <div class="features">inherited</div>
</dd>
        <dt id="generateUrl" class="callable inherited">
          <span class="name"><a href="dart_otp/TOTP/generateUrl.html">generateUrl</a></span><span class="signature">(<wbr>{<span class="parameter" id="generateUrl-param-issuer"><span class="type-annotation">String</span> <span class="parameter-name">issuer</span>, </span> <span class="parameter" id="generateUrl-param-account"><span class="type-annotation">String</span> <span class="parameter-name">account</span></span> })
            <span class="returntype parameter">&#8594; String</span>
          </span>
                  </dt>
        <dd class="inherited">
          Generate a url with OTP instance. <a href="dart_otp/TOTP/generateUrl.html">[...]</a>
                  <div class="features">inherited</div>
</dd>
        <dt id="noSuchMethod" class="callable inherited">
          <span class="name"><a href="dart_otp/TOTP/noSuchMethod.html">noSuchMethod</a></span><span class="signature">(<wbr><span class="parameter" id="noSuchMethod-param-invocation"><span class="type-annotation">Invocation</span> <span class="parameter-name">invocation</span></span>)
            <span class="returntype parameter">&#8594; dynamic</span>
          </span>
                  </dt>
        <dd class="inherited">
          Invoked when a non-existent method or property is accessed. <a href="dart_otp/TOTP/noSuchMethod.html">[...]</a>
                  <div class="features">inherited</div>
</dd>
        <dt id="toString" class="callable inherited">
          <span class="name"><a href="dart_otp/TOTP/toString.html">toString</a></span><span class="signature">(<wbr>)
            <span class="returntype parameter">&#8594; String</span>
          </span>
                  </dt>
        <dd class="inherited">
          Returns a string representation of this object.
                  <div class="features">inherited</div>
</dd>
      </dl>
    </section>

    <section class="summary offset-anchor inherited" id="operators">
      <h2>Operators</h2>
      <dl class="callables">
        <dt id="operator ==" class="callable inherited">
          <span class="name"><a href="dart_otp/TOTP/operator_equals.html">operator ==</a></span><span class="signature">(<wbr><span class="parameter" id="==-param-other"><span class="type-annotation">dynamic</span> <span class="parameter-name">other</span></span>)
            <span class="returntype parameter">&#8594; bool</span>
          </span>
                  </dt>
        <dd class="inherited">
          The equality operator. <a href="dart_otp/TOTP/operator_equals.html">[...]</a>
                  <div class="features">inherited</div>
</dd>
      </dl>
    </section>




  </div> <!-- /.main-content -->

  <div id="dartdoc-sidebar-right" class="col-xs-6 col-sm-6 col-md-2 sidebar sidebar-offcanvas-right">
    <ol>
      <li class="section-title"><a href="dart_otp/TOTP-class.html#constructors">Constructors</a></li>
      <li><a href="dart_otp/TOTP/TOTP.html">TOTP</a></li>
    
      <li class="section-title">
        <a href="dart_otp/TOTP-class.html#instance-properties">Properties</a>
      </li>
      <li><a href="dart_otp/TOTP/extraUrlProperties.html">extraUrlProperties</a></li>
      <li><a href="dart_otp/TOTP/interval.html">interval</a></li>
      <li><a href="dart_otp/TOTP/type.html">type</a></li>
      <li class="inherited"><a href="dart_otp/TOTP/algorithm.html">algorithm</a></li>
      <li class="inherited"><a href="dart_otp/TOTP/digits.html">digits</a></li>
      <li class="inherited"><a href="dart_otp/TOTP/hashCode.html">hashCode</a></li>
      <li class="inherited"><a href="dart_otp/TOTP/runtimeType.html">runtimeType</a></li>
      <li class="inherited"><a href="dart_otp/TOTP/secret.html">secret</a></li>
    
      <li class="section-title"><a href="dart_otp/TOTP-class.html#instance-methods">Methods</a></li>
      <li><a href="dart_otp/TOTP/now.html">now</a></li>
      <li><a href="dart_otp/TOTP/value.html">value</a></li>
      <li><a href="dart_otp/TOTP/verify.html">verify</a></li>
      <li class="inherited"><a href="dart_otp/TOTP/generateOTP.html">generateOTP</a></li>
      <li class="inherited"><a href="dart_otp/TOTP/generateUrl.html">generateUrl</a></li>
      <li class="inherited"><a href="dart_otp/TOTP/noSuchMethod.html">noSuchMethod</a></li>
      <li class="inherited"><a href="dart_otp/TOTP/toString.html">toString</a></li>
    
      <li class="section-title inherited"><a href="dart_otp/TOTP-class.html#operators">Operators</a></li>
      <li class="inherited"><a href="dart_otp/TOTP/operator_equals.html">operator ==</a></li>
    
    
    
    </ol>
  </div><!--/.sidebar-offcanvas-->

</main>

<footer>
  <span class="no-break">
    dart_otp 1.3.0
  </span>

  
</footer>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="static-assets/typeahead.bundle.min.js"></script>
<script src="static-assets/highlight.pack.js"></script>
<script src="static-assets/URI.js"></script>
<script src="static-assets/script.js"></script>


</body>

</html>
